package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global"
    scm "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/scm/v3"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/scm/v3/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/scm/v3/region"
)

func main() {
    ak := "T8SUKMGYTK9DXTEV8THT"
    sk := "ZQOD8bS0QIyVBJSx4ZfLWfpyYRw4dij5tOSmPoDx"

    auth := global.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := scm.NewScmClient(
        scm.ScmClientBuilder().
            WithRegion(region.ValueOf("cn-north-4")).
            WithCredential(auth).
            Build())

    request := &model.ListCertificatesRequest{}
    response, err := client.ListCertificates(request)
    if err == nil {
	    fmt.Printf("response: %+v\n", response)
	    //fmt.Printf("response.Certificates: %v\n",*response.Certificates)
	    for i,v := range *response.Certificates {
                fmt.Printf("response.Certificates index: %v, value: %v\n",i,v)
                fmt.Printf("response.Certificates domain: %v, expire_time: %v\n",v.Domain,v.ExpireTime)
                fmt.Printf("response.Certificates domain:type %T, expire_time:type %T\n",v.Domain,v.ExpireTime)
	    }
    } else {
        fmt.Println(err)
    }
}
